//
//  ZRNavigationViewController.m
//  ReadKit
//
//  Created by yd on 16/3/8.
//  Copyright © 2016年 yd. All rights reserved.
//

#import "ZRNavigationViewController.h"

#define NavBarThemeColor [UIColor colorWithRed:72/255.0f green:131/255.0f blue:246/255.0f alpha:1]


@interface ZRNavigationViewController ()

@end

@implementation ZRNavigationViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
}


+(void)initialize{
    UIBarButtonItem *item = [UIBarButtonItem appearance ];
    
    NSMutableDictionary *textAttrs = [NSMutableDictionary dictionary];
    textAttrs[NSForegroundColorAttributeName ] = [UIColor whiteColor];
    textAttrs[NSFontAttributeName] = [UIFont systemFontOfSize:16];
    [item setTitleTextAttributes:textAttrs forState:UIControlStateNormal];
    [item setTitleTextAttributes:textAttrs forState:UIControlStateHighlighted];
    
    
}

+(void)setupNacBarTheme{
    UINavigationBar *bar = [UINavigationBar appearance];
    [bar setBackgroundImage:[self createImageWithColor:NavBarThemeColor] forBarMetrics:UIBarMetricsDefault];
    [bar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor], NSForegroundColorAttributeName,nil]];
    UITabBar *tabBar = [UITabBar appearance];
    
    [tabBar setTintColor:NavBarThemeColor];
    tabBar.backgroundColor = [UIColor whiteColor];
    
}

+(UIImage *)createImageWithColor:(UIColor *)color{
    CGRect rect = CGRectMake(0.0f, 0.0f, 1.0f, 1.0f);
    UIGraphicsBeginImageContext(rect.size);
    CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextFillRect(context, rect);
    UIImage *theImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return theImage;
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
